<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf" %>
<script type="text/javascript" src="${ctx}/js/qc/un/un_add.js">
</script>
<style type="text/css">
.col-sm-3 {
	width: 20%;
	float: left;
}

.col-sm-9 {
	width: 50%;
	float: left;
}
label[class^="btn btn-default"]{
	margin-top: -4px;
}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/un/addUn.shtml">
		<section class="panel panel-default">
		<div class="panel-body">
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">不合格产品申请编号</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh"
						placeholder="" name="UnqualifiedFormMap.code" id="code">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品名称</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkName"
						placeholder="" name="UnqualifiedFormMap.product" id="product">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">不合格项目</label>
				<div class="col-sm-9">
				<div class="input-group">
					<input type="text" class="form-control" placeholder=""
						name="UnqualifiedFormMap.unproject" id="unproject">
					<span class="input-group-btn">
						<button class="btn btn-info" id="workorder" type="button"
							style="height: 34px;"
							onclick="getNcCodeGroup('nc_code_group_no','nc_code_group_no');">
							<span class="glyphicon glyphicon-search"></span>
						</button>
					</span>
					</div>
				</div>
			</div>


			<div class="form-group">
				<label class="col-sm-3 control-label">不合格数量</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkName"
						   placeholder="" name="UnqualifiedFormMap.number" id="number">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">加工时间</label>
				<div class="col-sm-9">
					<input type="date" class="form-control"
						   name="UnqualifiedFormMap.prdate"
						   id="prdate">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">申请人</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkName"
						   placeholder="" name="UnqualifiedFormMap.proposer" id="proposer">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">申请时间</label>
				<div class="col-sm-9">
					<input type="date" class="form-control"
						   name="UnqualifiedFormMap.applytime"
						   id="applytime">
				</div>
			</div>

		</div>
		<footer class="panel-footer text-right bg-light lter">
			<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer> 
		</section>
	</form>
	<script type="text/javascript">
		//自动生成id
		//
		$(document).ready(function(){
			var myDate = getNowFormatDate();
			$("#ofcode").val("OF"+ myDate + getRandomInt(100,1000));
		});
		function getNowFormatDate() {
			var date = new Date();
			var seperator1 = "-";
			var seperator2 = ":";
			var year = date.getFullYear();
			var month = date.getMonth() + 1;
			var strDate = date.getDate();
			if (month >= 1 && month <= 9) {
				month = "0" + month;
			}
			if (strDate >= 0 && strDate <= 9) {
				strDate = "0" + strDate;
			}
			//OF2022-02-12 13:52:30
			var currentdate = year + seperator1 + month + seperator1 + strDate
					+ date.getHours() + seperator2 + date.getMinutes()
					+ seperator2 + date.getSeconds();
			currentdate= currentdate.replaceAll("-","");
			currentdate= currentdate.replaceAll(":","");
			return currentdate;
		}

		function getRandomInt(min, max) {
			min = Math.ceil(min);
			max = Math.floor(max);
			return Math.floor(Math.random() * (max - min)) + min; //不含最大值，含最小值
		}
	</script>
</body>
</html>